package com.heeexy.example.service;

import com.alibaba.fastjson.JSONObject;
import com.heeexy.example.dao.AdvertiseDao;
import com.heeexy.example.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdvertiseService {

    @Autowired
    AdvertiseDao advertiseDao;
    /**
     * 广告列表
     */
    public JSONObject listAdvertise(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = advertiseDao.countAdvertise();
        List<JSONObject> list = advertiseDao.listAdvertise(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    /**
     * 改变广告上下线状态
     */

    public JSONObject changeAdvertise(JSONObject jsonObject) {
        System.out.println(jsonObject);
        advertiseDao.changeAdvertise(jsonObject);
        return CommonUtil.successJson();
    }
}
